﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data;
using System.Data.Common;
using System.Data.OleDb;


namespace So_Tu_Phap
{
    class ConnectToDB
    {
        public static string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=C:\DB ACCESS/SoTuPhapDB.mdb";//quanlytienluong.accdb
        public static OleDbConnection getConnection()
        {
            OleDbConnection con = new OleDbConnection(connectionString);
            try
            {
                con.Open();
               
            }
            catch
            {
                con = null;
                
            }
            return con;
        }

        public static void CloseConnection(OleDbConnection con)
        {
            try
            {
                con.Close();
            }
            catch
            {
                con = null;
            }
        }
    }
}
